package channelLogger

import (
	"gitee.com/fierce_wolf/go-fox-edge-common/commConfig"
	"gitee.com/fierce_wolf/go-fox-edge-common/commLogger"
	"gitee.com/fierce_wolf/go-fox-edge-common/commUtil/Map"
)

func PrintConnectLogger(text string) {
	configValue, err := commConfig.GetConfigParam("serverConfig")
	if err != nil {
		return
	}

	logger := Map.GetBool(configValue, "logger", false)
	if logger != true {
		return
	}

	commLogger.Console.Info(text)
}

func PrintChannelLogger(channelName string, act string, text string) {
	configValue, err := commConfig.GetConfigParam("serverConfig")
	if err != nil {
		return
	}

	logger := Map.GetBool(configValue, "logger", false)
	if logger != true {
		return
	}

	name := Map.GetString(configValue, "channelName", "")
	if name != channelName {
		return
	}

	commLogger.Console.Info(act + ":" + name + "->" + text)
}
